Skip to content

Safety net: CI, one column conversion, readable types, doctest test - #21

Merged
cedricvogel-leo merged 4 commits into
mainfrom
chore/absichern
Oct 25, 2026
Merged

cedricvogel-leo merged 4 commits into
mainfrom
chore/absichern

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

Package 1 «Absichern»: a safety net before new features. The only visible change is the type display (item 3).

Changes

  1. CI (.github/workflows/ci.yml): one job on every push and PR.
    • npm ci (with npm cache), lint, the embed build, test:protocol, test:runtime.
    • Python 3.12, Pyodide's version.
    • What needs Pyodide in a browser is skipped explicitly: a notice in every run names the worker (run, REPL, Tests in the browser, input(), gturtle) and the UI.
  2. One column conversion: _glpython_text_before gives the text in front of an offset; _glpython_ui_column builds on it. The docstring detection of the call boxes and the condition comments of the → chain no longer handle bytes themselves. The regression test now also covers a docstring and a condition on lines with ä and 🙂.
  3. Readable types: type(a) != list now steps to int != list instead of <class 'int'> != list, in the visualizer and in the copied → chain. Output from print and the REPL keeps Python's repr. New test: scripts/check-runtime-values.py.
  4. A test for the doctest runner (scripts/check-runtime-doctests.py), ahead of package 2, which will extend doctests.py. It covers:
    • the summary;
    • failing examples with doctest's report and want/got;
    • exceptions in examples;
    • the print hint and the __main__ guard;
    • umlauts and 🙂;
    • an import of another project file;
    • files without examples and files that don't load;
    • restoring the display hook.

test:runtime runs all three runtime scripts. Each new test fails when its code is broken on purpose: a byte slice in the condition comment; the type display before this PR; a disabled print hint; a changed want text.

Follow-ups (low priority, not changed here)

  • A variable holding a type (t = type(x)) isn't replaced by its value.
  • Types inside containers still show Python's repr.
  • The variables panel shows «Klasse» for such a variable.

🤖 Generated with Claude Code

cedricvogel-leo and others added 4 commits October 25, 2026 15:27
The docstring detection for call boxes sliced a line by an ast byte offset,
and the condition comments of the → chain decoded byte offsets themselves.
Both now use _glpython_text_before, which _glpython_ui_column builds on, so
every offset into a line goes through one place. The regression test covers
a docstring and a condition on lines with ä and 🙂.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
type(a) != list stepped to <class 'int'> != list; it now steps to
int != list, in substitutions and in the copied → chain alike, as the course's
evaluator is traced on paper. The program's own output keeps Python's repr.
test:runtime runs the new scripts/check-runtime-values.py too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One job on every push and pull request: npm ci, lint, the embed build,
test:protocol and test:runtime (CPython 3.12, Pyodide's version). What needs
Pyodide in a browser isn't checked; a notice in the run says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/check-runtime-doctests.py runs src/runtime/doctests.py as the Tests
button does: the summary, failing examples with doctest's report and the
want/got texts for «Erhalten · Erwartet», exceptions, the print hint, the
__main__ guard, umlauts and 🙂, imports of another project file, files
without examples, files that don't load, and the restored display hook.
test:runtime (and so CI) runs it too, ahead of the German hints that will
extend doctests.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit eef6799 into main Oct 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant